<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:set var="roleCellWidth" value="${50 / fn:length(roles)}"/>

<div id="roleManagementListDiv">
	<font id="mark"></font>	
	<form:form name="roleManagementListForm" id="roleManagementListForm" action="saveRoleManagement.do" method="post" modelAttribute="rmb">
	<div class="main_form">
		<div class="form_head">
			<h4>Link Management</h4>
			<br class="clear">
		</div>
		<div class="form_cont" id="actionalertContent">
			<div style="overflow: auto; border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px; margin-right: 16px">
			<table class="tablesorter" border="0" cellpadding="0" cellspacing="0">
				<tbody>
					<tr>
					   <td class="grid-header" width="50%"></td>
		               <c:forEach items="${roles}" var="role">
		                   <td class="grid-header" width="${roleCellWidth}%">
		                       <div style="white-space: normal; width: 100%;text-align: center;font-size: 11px;">
		                           ${role.shortDisplayName}
		                       </div>
		                   </td>
		               </c:forEach>				
					</tr>
				</tbody>
			</table>
			</div>
			<div style="overflow: auto; height: 550px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px">
				<table class="tablesorter" border="0" cellpadding="0"  cellspacing="0">
			     <tbody>
					<c:forEach items="${rmb.linkList}" var="link" varStatus="loop">
					   <tr>
		                   <td width="50%">${link.displayName}</td>
						  <c:forEach items="${link.rolesEntryList}" var="roleEntry" varStatus="loop">   						       			    	
							  <td width="${roleCellWidth}%">
		                      	<div style="white-space: normal; width: 100%;text-align: center;">
							  		<form:checkbox path="linkRoleEntryList" value="${roleEntry}" />
		                      	</div>
			              	  </td>
		              	  </c:forEach>
					  </tr>	
					</c:forEach>
					<tr>
						<td class="input-field" align="center" colspan="5">
							<sj:submit id="saveLink" nameKey="roleManagementLinkSave" target="roleManagementListDiv" key="editDonor.button.save" validate="true" cssClass="blue_btn"/>
						</td>					
					</tr>					
	 	             </tbody>
				</table>
			</div>			
		</div>
		<!-- closed scroll div -->
			</div>

		<div class="main_form">
		<div class="form_head">
			<h4>UIElement Management</h4>
			<br class="clear">
		</div>
		<div class="form_cont" id="actionalertContent">
			<div style="overflow: auto; border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px;; margin-right: 16px">
			<table class="tablesorter" border="0" cellpadding="0" cellspacing="0">
				<tbody>
					<tr>
					   <td class="grid-header" width="50%"></td>
		               <c:forEach items="${roles}" var="role">
		                   <td class="grid-header" width="${roleCellWidth}%">
		                       <div style="white-space: normal; width: 100%;text-align: center;font-size: 11px;">
		                           ${role.shortDisplayName}
		                       </div>
		                   </td>
		               </c:forEach>				
					</tr>
				</tbody>
			</table>
			</div>
			<div style="overflow: auto; height: 550px; border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px">
				<table class="tablesorter" border="0" cellpadding="0"  cellspacing="0">
			     <tbody>				
					<c:forEach items="${rmb.uiElementList}" var="uie" varStatus="loop">
					   <tr>
					   	  <td width="20%">${uie.submenuOrForm}</td>
	                   	  <td width="30%">${uie.nameOrValue}</td>
						  <c:forEach items="${uie.rolesEntryList}" var="roleEntry" varStatus="loop">   						       			    	
							  <td width="${roleCellWidth}%">
		                      	<div style="white-space: normal; width: 100%;text-align: center;">
							  		<form:checkbox path="uiElementRoleEntryList" value="${roleEntry}" />
		                      	</div>
			              	  </td>
		              	  </c:forEach>
					  </tr>	
					</c:forEach>					
					<tr>
						<td class="input-field" align="center" colspan="5">
							<sj:submit id="saveUiElement" nameKey="roleManagementUiElementSave" target="roleManagementListDiv" key="editDonor.button.save" validate="true" cssClass="blue_btn"/>
						</td>					
					</tr>					
	 	             </tbody>
				</table>
			</div>			
		</div>
		<!-- closed scroll div -->
			</div>
	     </form:form>
</div>